package com.app.aop;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.reflect.CodeSignature;

//@Component
//@Aspect
public class DiskAop {
    @Before(value = "execution(* com.app.service.impl.DiskService.*(..)) ||execution(public * com.app.utils.FileManager.*(..))")
    void before(JoinPoint joinPoint){
        CodeSignature codeSignature = (CodeSignature)joinPoint.getSignature();
        System.out.println("*********************");
        System.out.println(codeSignature.getName());
        System.out.println("*********************");
        String[] paramNames = codeSignature.getParameterNames();
        Object[] paramValues = joinPoint.getArgs();
        for (int i = 0; i < paramNames.length; i++)
            System.out.println(paramNames[i]+":"+paramValues[i]);
        System.out.println("-------------------");
    }
}
